home *** CD-ROM | disk | FTP | other *** search
-
- xscope briefer
-
- Knowledge to walk away with:
-
- o Fundamental performance aspects of the X protocol.
-
- o Use of xscope for X protocol tracing.
-
- o Basics of X protocol anaylsis.
-
- Fundamentals of the X protocol:
-
- o Requires reliable, byte stream (TCP, Unix sockets, shared
- memory transport all work).
-
- o Client generates requests.
-
- o Server generates replies, events, and errors.
-
- o Creating resources does not require round-trip; clients
- pick IDs from client's ID range.
-
- Inherent performance bottleneck:
-
- o Non-reply requests can be queued and batched.
-
- o But requests with replies = round-trips = slow.
-
- o Replies cause client/server context switching.
-
- o Replies lower I/O throughput by making queuing difficult.
-
- Round-trip statistics:
-
- o 16Mb Indy SC (operations/second)
- - 530,000 10-pixel segements (batched)
- - 225,000 NoOperation requests
- - 35,000 1-pixel triangles
- - 14,000 10x10 PutImage requests
-
- - 930 GetProperty requests
- - 775 10x10 GetImage requests
-
- o Notice 2-3 order of magnitude difference in request rate.
-
- o 45 round trips @ 1/20 second
-
- Peeking at the X protocol stream:
-
- o xscope is a pseudo-server
-
-
-
- ___________ ___________ ______________
- | | Requests | | Requests | |
- | | --------------> | | --------------> | |
- | X | | | | Xsgi |
- | | <--------------- | xscope | <--------------- | |
- | Client | Replies, | | Replies, | |
- | | Events, | | Events, | |
- | | Errors | | Errors | |
- |_________| |_________| |____________|
- |
- |
- |
- V
- X protocol trace
- to stdout
-
-
- o Setting DISPLAY to the `fake' display makes client use xscope.
-
-
-
-
-
-
-
- Sample X protocol
- trace from
- xscope:
-
-
- Notice:
- Timestamps
- Client and server writes
- Decoded requests and replies
-
-
-
- 0.00: Client --> 12 bytes
- byte-order: MSB first
- major-version: 000b
- minor-version: 0000
- 0.04: 520 bytes <-- X11 Server
- protocol-major-version: 000b
- protocol-minor-version: 0000
- release-number: 00001388
- resource-id-base: 0b800000
- resource-id-mask: 003fffff
- motion-buffer-size: 00000000
- image-byte-order: MSB first
- bitmap-format-bit-order: MSB first
- bitmap-format-scanline-unit: 20
- bitmap-format-scanline-pad: 20
- min-keycode: 10 (^J)
- max-keycode: 118 (v)
- vendor: "Silicon Graphics"
- pixmap-formats: (4)
- roots: (2)
- 0.05: Client --> 84 bytes
- ............REQUEST: CreateGC
- graphic-context-id: GXC 0b800000
- drawable: DWB 0000002a
- value-mask: background
- value-list:
- background: 00000007
- ............REQUEST: CreateGC
- graphic-context-id: GXC 0b800001
- drawable: DWB 0000002c
- value-mask: background
- value-list:
- background: 00000007
- ............REQUEST: QueryExtension
- name: "BIG-REQUESTS"
- ............REQUEST: GetProperty
- delete: False
- window: WIN 0000002a
- property: <RESOURCE_MANAGER>
- type: <STRING>
- long-offset: 00000000
- 0.10: 104 bytes <-- X11 Server
- ..............REPLY: QueryExtension
- present: False
- major-opcode: 00
- first-event: 00
- first-error: 00
-
-
-
-
- Generating a trace with xscope:
-
- 1) Shell #1: setenv DISPLAY foobar:0
-
- 2) Shell #1: xscope >& trace_file
-
- 3) Shell #2: setenv DISPLAY foobar:1
-
- 4) Shell #2: run X client like: xlogo
-
- 5) Shell #2: ^C or kill client
-
- 6) Shell #1: ^C the xscope
-
- 7) examine trace_file...
-
-
-
-
- Introduction to X protocol analysis:
-
- o Helps to have X Protocol Reference Manual Volume 0 handy.
- o Question round-trips.
- o Look for duplicate requests.
- o Leaking pixmaps or freeing pixmaps before using.
- o Drawing to unmapped windows.
- o Unneeded events, for example NoExpose.
- o Interning atoms. Why?
- o Opening duplicate fonts?
- o Requesting QueryColors repeatedly?
-
-
-
-
- Using xprotostats for quick overview:
-
-
- hoot% xprotostats < ICONBOOK.xscope
-
- RAW CLIENT PROTOCOL STATISITICS:
- bytes written: 41488
- batches written: 409
- requests made: 1850
- RAW SERVER PROTOCOL STATISITICS:
- bytes written: 74412
- batches written: 419
- replies made: 420
- events sent: 104
- errors sent: 0
- COMPUTED STATISTICS:
- replies/request: 22.70 %
- server/client data: 179.36 %
- bytes/request: 22.43 bytes
- OFTEN MISUSED ROUND-TRIP REQUESTS:
- AllocColor 42
- AllocNamedColor 8
- GetGeometry 30
- GetInputFocus 30
- GetKeyboardMapping 17
- GetSelectionOwner 2
- GetWindowAttributes 20
- InternAtom 49
- ListFonts 3
- ListProperties 3
- QueryBestSize 1
- QueryColors 170
- QueryExtension 3
- QueryFont 10
- QueryTree 2
- TranslateCoordinates 1
- OFTEN MISUSED EVENTS:
- NoExposure 31
-
- hoot%
-
-
-
-
-
- Getting more information:
-
- o Read the xscope man page.
-
- o Peterson & Chang, ``Improving X Application Performance,''
- The X Resource, Summer 92.
-
- o O'Reilly & Associates' X Protocol Reference Manual Volume 0.
-
- o Marks & Cable, ``Trace Analysis of the X Window System
- Protocol,'' 7th X Tech Conference, 1993.
-